﻿/*
 This file is part of the OdinMS Maple Story Server
 Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
 Matthias Butz <matze@odinms.de>
 Jan Christian Meyer <vimes@odinms.de>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU Affero General Public License as
 published by the Free Software Foundation version 3 as published by
 the Free Software Foundation. You may not use, modify or distribute
 this program under any other version of the GNU Affero General Public
 License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU Affero General Public License for more details.
 
 You should have received a copy of the GNU Affero General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
/* Natalie
 Henesys VIP Hair/Hair Color Change.
 */
var status = 0;
var beauty = 0;
var hairprice = 1000000;
var haircolorprice = 1000000;
var mhair = Array(
        30000, 30020, 30040, 30050, 30060, 30100, 30110, 30120, 30130, 30140, 30150, 30180, 30190, 30200, 30210, 30220, 30230, 30240, 30250, 30260,
        30270, 30280, 30290, 30300, 30310, 30320, 30330, 30340, 30350, 30360, 30370, 30400, 30410, 30420, 30440, 30450, 30460, 30470, 30480, 30490,
        30510, 30520, 30520, 30530, 30540, 30550, 30560, 30570, 30580, 30590, 30600, 30610, 30620, 30630, 30640, 30650, 30660, 30670, 30680,
        30700, 30710, 30720, 30730, 30760, 30770, 30790, 30800, 30810, 30820, 30830, 30840, 30850, 30860, 30870, 30880, 30890, 30900, 30910, 30920,
        30930, 30940, 30950, 30990, 31000, 31010, 31020, 31030, 31040, 31050, 31060, 31070, 31080, 31090, 31100, 31110, 31120, 31145, 31140, 31150,
        31160, 31170, 31180, 31190, 31200, 31210, 31220, 31230, 31240, 31250, 31260, 31270, 31280, 31290, 31300, 31310, 31320, 31330, 31340, 31350,
        31360, 31370, 31400, 31410, 31420, 31440, 31450, 31460, 31470, 31480, 31490, 31510, 31520, 31530, 31540, 31550, 31560, 31570, 31580, 31590,
        31600, 31610, 31620, 31630, 31640, 31650, 31670, 31680, 31690, 31700, 31710, 31720, 31730, 31740, 31750, 31760, 31770, 31780, 31790, 31800,
        31811, 31820, 31830, 31840, 31850, 31860, 31870, 31880, 31890, 31900, 31910, 31920, 31930, 31950, 31990, 32020, 32120, 32027, 32131, 32140,
        32160, 32430, 32440, 32450, 32460, 32470, 32480, 32490, 32500, 32560, 32651, 32640, 32650, 32660, 33000, 33030, 33060, 33070, 33080,
        33090, 33100, 33110, 33120, 33135, 33140, 33150, 33160, 33170, 33180, 33190, 33200, 33210, 33220, 33230, 33240, 33250, 33260, 33270, 33280,
        33290, 33300, 33310, 33320, 33330, 33340, 33350, 33360, 33370, 33380, 33390, 33400, 33410, 33420, 33430, 33440, 33450, 33460, 33470, 33480);

var fhair = Array(
        30000, 30020, 30040, 30050, 30060, 30100, 30110, 30120, 30130, 30140, 30150, 30180, 30190, 30200, 30210, 30220, 30230, 30240, 30250, 30260,
        30270, 30280, 30290, 30300, 30310, 30320, 30330, 30340, 30350, 30360, 30370, 30400, 30410, 30420, 30440, 30450, 30460, 30470, 30480, 30490,
        30510, 30520, 30520, 30530, 30540, 30550, 30560, 30570, 30580, 30590, 30600, 30610, 30620, 30630, 30640, 30650, 30660, 30670, 30680,
        30700, 30710, 30720, 30730, 30760, 30770, 30790, 30800, 30810, 30820, 30830, 30840, 30850, 30860, 30870, 30880, 30890, 30900, 30910, 30920,
        30930, 30940, 30950, 30990, 31000, 31010, 31020, 31030, 31040, 31050, 31060, 31070, 31080, 31090, 31100, 31110, 31120, 31145, 31140, 31150,
        31160, 31170, 31180, 31190, 31200, 31210, 31220, 31230, 31240, 31250, 31260, 31270, 31280, 31290, 31300, 31310, 31320, 31330, 31340, 31350,
        31360, 31370, 31400, 31410, 31420, 31440, 31450, 31460, 31470, 31480, 31490, 31510, 31520, 31530, 31540, 31550, 31560, 31570, 31580, 31590,
        31600, 31610, 31620, 31630, 31640, 31650, 31670, 31680, 31690, 31700, 31710, 31720, 31730, 31740, 31750, 31760, 31770, 31780, 31790, 31800,
        31811, 31820, 31830, 31840, 31850, 31860, 31870, 31880, 31890, 31900, 31910, 31920, 31930, 31950, 31990, 32020, 32120, 32027, 32131, 32140,
        32160, 32430, 32440, 32450, 32460, 32470, 32480, 32490, 32500, 32560, 32651, 32640, 32650, 32660, 33000, 33030, 33060, 33070, 33080,
        33090, 33100, 33110, 33120, 33135, 33140, 33150, 33160, 33170, 33180, 33190, 33200, 33210, 33220, 33230, 33240, 33250, 33260, 33270, 33280,
        33290, 33300, 33310, 33320, 33330, 33340, 33350, 33360, 33370, 33380, 33390, 33400, 33410, 33420, 33430, 33440, 33450, 33460, 33470, 33480);

var mhair2 = Array(
        33490, 33500, 33510, 33520, 33530, 33540, 33550, 33580, 33590, 33600, 33610, 33620, 33630, 33640, 33650, 33660, 33670, 33680, 33690, 33700,
        33710, 33720, 33730, 33740, 33750, 33760, 33770, 33780, 33790, 33800, 33810, 33820, 33830, 33930, 33940, 33950, 33960, 33970, 33980, 33990,
        34000, 34010, 34040, 34090, 34100, 34110, 34120, 34130, 34140, 34150, 34160, 34170, 34180, 34190, 34200, 34210, 34220, 34230, 34240, 34250,
        34260, 34270, 34280, 34290, 34300, 34310, 34320, 34330, 34340, 34350, 34360, 34370, 34380, 34400, 34400, 34410, 34420, 34430, 34440, 34450,
        34480, 34490, 34510, 34540, 34560, 34590, 34600, 34610, 34620, 34630, 34640, 34650, 34660, 34670, 34680, 34690, 34700, 34710, 34720, 34730,
        34740, 34750, 34760, 34770, 34780, 34790, 34800, 34810, 34820, 34830, 34840, 34850, 34860, 34870, 34880, 34890, 34900, 34910, 34940, 34950,
        34960, 34970, 34980, 34990, 35000, 35010, 35020, 35030, 35040, 35050, 35060, 35070, 35080, 35090, 35100, 35150, 35160, 35170, 35180, 35190,
        35200, 35210, 35250, 35260, 35280, 35290, 35300, 35310, 35320, 35330, 35350, 35360, 35420, 35430, 35440, 35460, 35470, 35490, 35500, 35510,
        35520, 35530, 35540, 35550, 35560, 35570, 35580, 35600, 35620, 35630, 35640, 35650, 35660, 35680, 35690, 35700, 35710, 35720, 35780, 35790,
        35820, 35830, 35840, 35850, 35860, 35870, 35880, 35890, 35900, 35910, 35920, 35930, 35940, 35950, 35960, 36000, 36010, 36020, 36030, 36040,
        36050, 36070, 36080, 36090, 36100, 36110, 36120, 36130, 36140, 36150, 36160, 36170, 36180, 36190, 36200, 36210, 36220, 36230, 36240, 36250,
        36280, 36300, 36310, 36330, 36340, 36350, 36380, 36390, 36400, 36410, 36420, 36430, 36440, 36450, 36460, 36470, 36480, 36510, 36520, 36530
        );
var fhair2 = Array(
        33490, 33500, 33510, 33520, 33530, 33540, 33550, 33580, 33590, 33600, 33610, 33620, 33630, 33640, 33650, 33660, 33670, 33680, 33690, 33700,
        33710, 33720, 33730, 33740, 33750, 33760, 33770, 33780, 33790, 33800, 33810, 33820, 33830, 33930, 33940, 33950, 33960, 33970, 33980, 33990,
        34000, 34010, 34040, 34090, 34100, 34110, 34120, 34130, 34140, 34150, 34160, 34170, 34180, 34190, 34200, 34210, 34220, 34230, 34240, 34250,
        34260, 34270, 34280, 34290, 34300, 34310, 34320, 34330, 34340, 34350, 34360, 34370, 34380, 34400, 34400, 34410, 34420, 34430, 34440, 34450,
        34480, 34490, 34510, 34540, 34560, 34590, 34600, 34610, 34620, 34630, 34640, 34650, 34660, 34670, 34680, 34690, 34700, 34710, 34720, 34730,
        34740, 34750, 34760, 34770, 34780, 34790, 34800, 34810, 34820, 34830, 34840, 34850, 34860, 34870, 34880, 34890, 34900, 34910, 34940, 34950,
        34960, 34970, 34980, 34990, 35000, 35010, 35020, 35030, 35040, 35050, 35060, 35070, 35080, 35090, 35100, 35150, 35160, 35170, 35180, 35190,
        35200, 35210, 35250, 35260, 35280, 35290, 35300, 35310, 35320, 35330, 35350, 35360, 35420, 35430, 35440, 35460, 35470, 35490, 35500, 35510,
        35520, 35530, 35540, 35550, 35560, 35570, 35580, 35600, 35620, 35630, 35640, 35650, 35660, 35680, 35690, 35700, 35710, 35720, 35780, 35790,
        35820, 35830, 35840, 35850, 35860, 35870, 35880, 35890, 35900, 35910, 35920, 35930, 35940, 35950, 35960, 36000, 36010, 36020, 36030, 36040,
        36050, 36070, 36080, 36090, 36100, 36110, 36120, 36130, 36140, 36150, 36160, 36170, 36180, 36190, 36200, 36210, 36220, 36230, 36240, 36250,
        36280, 36300, 36310, 36330, 36340, 36350, 36380, 36390, 36400, 36410, 36420, 36430, 36440, 36450, 36460, 36470, 36480, 36510, 36520, 36530
        );
;
var mhair3 = Array(
        36560, 36570, 36580, 36590, 36600, 36610, 36620, 36630, 36640, 36650, 36660, 36670, 36680, 36690, 36700, 36710, 36720, 36730, 36740, 36750,
        36760, 36770, 36780, 36790, 36800, 36810, 36820, 36830, 36840, 36850, 36860, 36900, 36910, 36920, 36940, 36950, 36980, 36990, 37000, 37010,
        37020, 37030, 37040, 37050, 37060, 37070, 37080, 37090, 37100, 37110, 37120, 37130, 37140, 37190, 37210, 37220, 37230, 37240, 37250, 37260,
        37270, 37280, 37300, 37310, 37320, 37330, 37340, 37350, 37370, 37380, 37400, 37440, 37450, 37460, 37490, 37500, 37510, 37520, 37530, 37560,
        37570, 37580, 37590, 37610, 37620, 37630, 37640, 37650, 37670, 37680, 37690, 37700, 37710, 37720, 37730, 37740, 37750, 37760, 37770, 37780,
        37790, 37800, 37810, 37820, 37830, 37840, 37850, 37860, 37880, 37910, 37920, 37940, 37950, 37960, 37970, 37980, 37990, 38000, 38010, 38020,
        38030, 38040, 38050, 38060, 38070, 38090, 38100, 38110, 38120, 38130, 38250, 38260, 38270, 38290, 38300, 38310, 38380, 38390, 38400, 38410,
        38420, 38430, 38440, 38450, 38460, 38470, 38490, 38520, 38540, 38550, 38560, 38570, 38580, 38590, 38600, 38610, 38620, 38630, 38640, 38650,
        38660, 38670, 38680, 38690, 38700, 38710, 38730, 38740, 38750, 38760, 38800, 38810, 38820, 38840, 38860, 38880, 38890, 38900, 38910, 38940,
        38950, 38960, 38970, 38980, 38990, 39100, 39110, 39120, 39130, 39140, 39150, 39160, 39170, 39310, 39320, 39330, 39340, 39350, 39360
        );


var fhair3 = Array(
        36560, 36570, 36580, 36590, 36600, 36610, 36620, 36630, 36640, 36650, 36660, 36670, 36680, 36690, 36700, 36710, 36720, 36730, 36740, 36750,
        36760, 36770, 36780, 36790, 36800, 36810, 36820, 36830, 36840, 36850, 36860, 36900, 36910, 36920, 36940, 36950, 36980, 36990, 37000, 37010,
        37020, 37030, 37040, 37050, 37060, 37070, 37080, 37090, 37100, 37110, 37120, 37130, 37140, 37190, 37210, 37220, 37230, 37240, 37250, 37260,
        37270, 37280, 37300, 37310, 37320, 37330, 37340, 37350, 37370, 37380, 37400, 37440, 37450, 37460, 37490, 37500, 37510, 37520, 37530, 37560,
        37570, 37580, 37590, 37610, 37620, 37630, 37640, 37650, 37670, 37680, 37690, 37700, 37710, 37720, 37730, 37740, 37750, 37760, 37770, 37780,
        37790, 37800, 37810, 37820, 37830, 37840, 37850, 37860, 37880, 37910, 37920, 37940, 37950, 37960, 37970, 37980, 37990, 38000, 38010, 38020,
        38030, 38040, 38050, 38060, 38070, 38090, 38100, 38110, 38120, 38130, 38250, 38260, 38270, 38290, 38300, 38310, 38380, 38390, 38400, 38410,
        38420, 38430, 38440, 38450, 38460, 38470, 38490, 38520, 38540, 38550, 38560, 38570, 38580, 38590, 38600, 38610, 38620, 38630, 38640, 38650,
        38660, 38670, 38680, 38690, 38700, 38710, 38730, 38740, 38750, 38760, 38800, 38810, 38820, 38840, 38860, 38880, 38890, 38900, 38910, 38940,
        38950, 38960, 38970, 38980, 38990, 39100, 39110, 39120, 39130, 39140, 39150, 39160, 39170, 39310, 39320, 39330, 39340, 39350, 39360
        );

var hairnew = Array();
function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode < 1) {
        cm.dispose();
    } else {
        status++;
        if (status == 0)
            cm.sendSimple("您好，我是这间美髮店的老闆\r\n #e換頭髮前#r请先把頭髮顏色換成黑色以免造成斷線.\r\n #k \r\n请允許我把你的頭髮护理。请選擇一个你想要的.\r\n #L1#髮型1#l\r\n #L2#髮型2#l\r\n #L3#髮型3#l");
        else if (status == 1) {
            if (selection == 1) {
                beauty = 1;
                hairnew = Array();
                if (cm.getPlayer().getGender() == 0)
                    for (var i = 0; i < mhair.length; i++)
                        hairnew.push(mhair[i] + parseInt(cm.getPlayer().getHair() % 10));
                if (cm.getPlayer().getGender() == 1)
                    for (var i = 0; i < fhair.length; i++)
                        hairnew.push(fhair[i] + parseInt(cm.getPlayer().getHair() % 10));
                cm.sendStyle("選擇一个想要的.", hairnew);
            } else if (selection == 2) {
                beauty = 1;
                hairnew = Array();
                if (cm.getPlayer().getGender() == 0)
                    for (var i = 0; i < mhair2.length; i++)
                        hairnew.push(mhair2[i] + parseInt(cm.getPlayer().getHair() % 10));
                if (cm.getPlayer().getGender() == 1)
                    for (var i = 0; i < fhair2.length; i++)
                        hairnew.push(fhair2[i] + parseInt(cm.getPlayer().getHair() % 10));
                cm.sendStyle("選擇一个想要的.", hairnew);
            } else if (selection == 3) {
                beauty = 1;
                hairnew = Array();
                if (cm.getPlayer().getGender() == 0)
                    for (var i = 0; i < mhair3.length; i++)
                        hairnew.push(mhair3[i] + parseInt(cm.getPlayer().getHair() % 10));
                if (cm.getPlayer().getGender() == 1)
                    for (var i = 0; i < fhair3.length; i++)
                        hairnew.push(fhair3[i] + parseInt(cm.getPlayer().getHair() % 10));
                cm.sendStyle("選擇一个想要的.", hairnew);
            }
        } else if (status == 2) {
            if (beauty == 1) {

                cm.setHair(hairnew[selection]);
                cm.sendOk("享受!");
                cm.dispose();

            }
        }
    }
}
